import { S } from '../../s';
import { IPSAppDEAction } from '../dataentity/ipsapp-deaction';
import { IPSAppDataEntity } from '../dataentity/ipsapp-data-entity';
import { IPSAppUILogicRefView } from './ipsapp-uilogic-ref-view';
import { IPSAppUINewDataLogic } from './ipsapp-uinew-data-logic';
import { PSAppUILogicImpl } from './psapp-uilogic-impl';

export class BuiltinPSAppUINewDataLogicImpl
  extends PSAppUILogicImpl
  implements IPSAppUINewDataLogic
{
  get actionAfterWizard(): string {
    return this.M.actionAfterWizard;
  }

  protected batchaddpsappdeaction: IPSAppDEAction;
  getBatchAddPSAppDEAction(): IPSAppDEAction | null {
    if (this.batchaddpsappdeaction != null) return this.batchaddpsappdeaction;
    const value = this.M.getBatchAddPSAppDEAction;
    if (value == null) {
      return;
    }
    const ipsappdataentity = this.getParentPSModelObject(
      S._f,
    ) as IPSAppDataEntity;
    if (ipsappdataentity != null) {
      this.batchaddpsappdeaction = ipsappdataentity.findPSAppDEAction(value);
    }
    return this.batchaddpsappdeaction;
  }

  protected batchaddpsappviews: IPSAppUILogicRefView[];
  getBatchAddPSAppViews(): IPSAppUILogicRefView[] | null {
    return (
      this.batchaddpsappviews ||
      (this.batchaddpsappviews = this.fillChildListModel(
        this.M.getBatchAddPSAppViews,
        S._5,
      ) as IPSAppUILogicRefView[])
    );
  }

  protected newdatapsappview: IPSAppUILogicRefView;
  getNewDataPSAppView(): IPSAppUILogicRefView | null {
    return (
      this.newdatapsappview ||
      (this.newdatapsappview = this.fillObjectModel(
        S._5,
        this.M.getNewDataPSAppView,
        S._370,
      ) as IPSAppUILogicRefView)
    );
  }

  protected newdatapsappviews: IPSAppUILogicRefView[];
  getNewDataPSAppViews(): IPSAppUILogicRefView[] | null {
    return (
      this.newdatapsappviews ||
      (this.newdatapsappviews = this.fillChildListModel(
        this.M.getNewDataPSAppViews,
        S._5,
      ) as IPSAppUILogicRefView[])
    );
  }

  get viewLogicType(): string {
    return this.M.viewLogicType;
  }

  protected wizardpsappview: IPSAppUILogicRefView;
  getWizardPSAppView(): IPSAppUILogicRefView | null {
    return (
      this.wizardpsappview ||
      (this.wizardpsappview = this.fillObjectModel(
        S._5,
        this.M.getWizardPSAppView,
        S._371,
      ) as IPSAppUILogicRefView)
    );
  }

  get batchAddOnly(): boolean {
    return this.M.batchAddOnly;
  }

  get enableBatchAdd(): boolean {
    return this.M.enableBatchAdd;
  }

  get enableWizardAdd(): boolean {
    return this.M.enableWizardAdd;
  }
  get cls(): string {
    return 'BuiltinPSAppUINewDataLogicImpl';
  }
  instanceof(cls: string): boolean {
    if (cls == S._280 || cls == S._281 || cls == S._27e || cls == S._27f)
      return true;
    return super.instanceof(cls);
  }
}
